home *** CD-ROM | disk | FTP | other *** search
- Path: news.telepac.pt!usenet
- From: jcarlosr@mail.telepac.pt (J.Carlos)
- Newsgroups: comp.lang.c++
- Subject: Re: Newbie Q: Is there a Static pointer?
- Date: Sat, 03 Feb 1996 22:44:36 GMT
- Organization: telepac
- Message-ID: <4f0s5h$qbq@vivaldi.telepac.pt>
- References: <1996Jan27.223516.19031@freenet.victoria.bc.ca>
- NNTP-Posting-Host: alv1_p8.telepac.pt
- X-Newsreader: Forte Free Agent 1.0.82
-
- ua187@freenet.Victoria.BC.CA (Alex Walker) wrote:
-
-
-
- > I'm learning C++ and at the moment making a doubly linked-list.
- > I'd like to have a pointer to an object of which there is only 1
- > copy and all memeber of the class (each node in the list) can use it.
- > This sounds like a static pointer, but does such an animal exists??.
-
- Yes the animal exists, but don't forget to inicialize it, like this :
-
- class SOMECLASS
- {
- static int x;
- public:
- SOMECLASS();
- SOMECLASS();
- };
-
- int SOMECLASS::x = 0;
-
- Hope this helps, J.Carlos
- jcarlosr@mail.telepac.pt
-
-
-